import request from '@/utils/request'

const api_name = '/admin/product/category'

// 根据parentId获取下级节点
export const FindCategoryByParentId = parentId => {
  return request({
    url: `${api_name}/list/${parentId}`,
    method: 'get',
  })
}

// 根据id获取上级节点
export const FindParentCategoryById = currentId => {
  return request({
    url: `${api_name}/listParent/${currentId}`,
    method: 'get',
  })
}

// 导出方法
export const ExportCategoryData = () => {
  return request({
    url: `${api_name}/exportData`,
    method: 'get',
    // 这里指定响应类型为blob类型: 二进制数据类型
    responseType: 'blob',
  })
}
